package com.bruce.demo2.patterns.demo1.creational.demo01.singleton.demo02;

/**
 * @PROJECT_NAME design_patterns
 * @DESCRIPTION 测试类
 * @AUTHOR CNBruceLee
 * @DATE 2021/7/1 21:43
 */
public class Test {
    public static void main(String[] args) {
        Singleton instance1 = Singleton.getInstance();
        Singleton instance2 = Singleton.getInstance();
        // == 好使判断对象内地址 如果相同则是同一个对象
        System.out.println(instance1 == instance2);
        //判断hashcode 相同则是同一个对象
        System.out.println(instance1.hashCode());
        System.out.println(instance2.hashCode());
    }
}
